package com.atguigu.day73_demo;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;

public class BlockingQueueDemo {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> blockingQueue = new ArrayBlockingQueue(4);
//        System.out.println(blockingQueue.add("张三"));
//        System.out.println(blockingQueue.add("李四"));
//        System.out.println(blockingQueue.add("王五"));
//        System.out.println(blockingQueue.add("赵六"));
////       // System.out.println(  blockingQueue.add("田七"));
//
//       System.out.println(blockingQueue.remove());
//        System.out.println(blockingQueue.remove());
//        System.out.println(blockingQueue.remove());
//        System.out.println(blockingQueue.remove());
//        //System.out.println(blockingQueue.remove());
//
//        System.out.println( blockingQueue.element());

//        System.out.println(blockingQueue.offer("张三"));
//        System.out.println(blockingQueue.offer("赵六"));
//        System.out.println(blockingQueue.offer("王五"));
//        System.out.println(blockingQueue.offer("田七"));
//      //  System.out.println(blockingQueue.offer("李四"));

//        System.out.println(blockingQueue.poll());
//        System.out.println(blockingQueue.poll());
//        System.out.println(blockingQueue.poll());
//        System.out.println(blockingQueue.poll());
//        System.out.println(blockingQueue.poll());
        //System.out.println(blockingQueue.peek());
blockingQueue.put("张三");
blockingQueue.put("李四");
blockingQueue.put("王五");
blockingQueue.put("赵六");
blockingQueue.put("田七");
System.out.println("Hello");

//        blockingQueue.offer("a",10, TimeUnit.SECONDS);
//        blockingQueue.offer("b",10, TimeUnit.SECONDS);
//        blockingQueue.offer("c",10, TimeUnit.SECONDS);
//        blockingQueue.offer("d",10, TimeUnit.SECONDS);
//        blockingQueue.offer("e",10, TimeUnit.SECONDS);
//        System.out.println("=======");


    }
}


